home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / ietf / urn / urn-archives / urn-ietf.archive.9610 / 000123_owner-urn-ietf _Wed Oct 30 12:50:00 1996.msg < prev    next >
Internet Message Format  |  1997-02-19  |  40KB

  1. Received: (from daemon@localhost) by services.bunyip.com (8.6.10/8.6.9) id MAA02131 for urn-ietf-out; Wed, 30 Oct 1996 12:50:00 -0500
  2. Received: from mocha.bunyip.com (mocha.Bunyip.Com [192.197.208.1]) by services.bunyip.com (8.6.10/8.6.9) with SMTP id MAA02126 for <urn-ietf@services.bunyip.com>; Wed, 30 Oct 1996 12:49:53 -0500
  3. Received: from acl.lanl.gov by mocha.bunyip.com with SMTP (5.65a/IDA-1.4.2b/CC-Guru-2b)
  4.         id AA15067  (mail destined for urn-ietf@services.bunyip.com); Wed, 30 Oct 96 12:49:45 -0500
  5. Received: from legiron.acl.lanl.gov (legiron.acl.lanl.gov [128.165.147.188]) by acl.lanl.gov (8.7.3/8.7.3) with SMTP id KAA09252 for <urn-ietf@bunyip.com>; Wed, 30 Oct 1996 10:49:42 -0700 (MST)
  6. Message-Id: <2.2.32.19961030175727.007123b0@acl.lanl.gov>
  7. X-Sender: rdaniel@acl.lanl.gov
  8. X-Mailer: Windows Eudora Pro Version 2.2 (32)
  9. Mime-Version: 1.0
  10. Content-Type: text/plain; charset="us-ascii"
  11. Date: Wed, 30 Oct 1996 10:57:27 -0700
  12. To: urn-ietf@bunyip.com
  13. From: Ron Daniel <rdaniel@acl.lanl.gov>
  14. Subject: [URN] current version of NPATR draft
  15. Sender: owner-urn-ietf@services.bunyip.com
  16. Precedence: bulk
  17. Reply-To: Ron Daniel <rdaniel@acl.lanl.gov>
  18. Errors-To: owner-urn-ietf@bunyip.com
  19.  
  20. Hi all,
  21.  
  22. Some personal things have come up that have eaten most of my time,
  23. thus my relative quiet on the list.  The WG charter calls for the
  24. NAPTR draft to be submitted this month. Earlier versions have been
  25. submitted, but here is the one that incorporates a lot of the feedback
  26. we have had up to now.  I'm sending this to the ID editor today.
  27.  
  28. This draft does not yet address the issue of how regexps might deal with
  29. international character sets, partly because we haven't finalized that
  30. but mostly because of lack of time to look into solutions to that problem.
  31.  
  32. ------
  33.  
  34. INTERNET DRAFT                                                  Ron Daniel
  35. draft-ietf-urn-naptr-00.txt                 Los Alamos National Laboratory
  36.                                                           Michael Mealling
  37.                                                    Network Solutions, Inc.
  38.                                                              30 Oct., 1996
  39.  
  40.  
  41.                 Resolution of Uniform Resource Identifiers
  42.                        using the Domain Name System
  43.  
  44.  
  45. Status of this Memo
  46. ===================
  47.  
  48.     This document is an Internet-Draft.  Internet-Drafts are working
  49.     documents of the Internet Engineering Task Force (IETF), its
  50.     areas, and its working groups.  Note that other groups may also
  51.     distribute working documents as Internet-Drafts.
  52.   
  53.     Internet-Drafts are draft documents valid for a maximum of six
  54.     months and may be updated, replaced, or obsoleted by other
  55.     documents at any time.  It is inappropriate to use Internet-
  56.     Drafts as reference material or to cite them other than as
  57.     ``work in progress.''
  58.   
  59.     To learn the current status of any Internet-Draft, please check
  60.     the ``1id-abstracts.txt'' listing contained in the Internet-
  61.     Drafts Shadow Directories on ftp.is.co.za (Africa),
  62.     nic.nordu.net (Europe), munnari.oz.au (Pacific Rim),
  63.     ds.internic.net (US East Coast), or ftp.isi.edu (US West Coast).
  64.  
  65.     This draft expires 05 May, 1997.
  66.   
  67.   
  68.  
  69. Abstract:
  70. =========
  71.  
  72. Uniform Resource Locators (URLs) are the foundation of the World Wide
  73. Web, and are a vital Internet technology. However, they have proven to
  74. be brittle in practice. The basic problem is that URLs typically
  75. identify a particular path to a file on a particular host. There is no
  76. graceful way of changing the path or host once the URL has been
  77. assigned. Neither is there a graceful way of replicating the resource
  78. located by the URL to achieve better network utilization and/or fault
  79. tolerance. Uniform Resource Names (URNs) have been hypothesized as a
  80. adjunct to URLs that would overcome such problems. URNs and URLs
  81. are both instances of a broader class of identifiers known as Uniform
  82. Resource Identifiers (URIs).
  83.  
  84. This document describes a new DNS Resource Record, NAPTR (Naming
  85. Authority PoinTeR), that provides rules for mapping parts of URIs to
  86. domain names.  By changing the mapping rules, we can change the host
  87. that is contacted to resolve a URI. This will allow a more graceful
  88. handling of URLs over long time periods, and forms the foundation for a
  89. new proposal for Uniform Resource Names.
  90.  
  91. In addition to locating resolvers, the NAPTR provides for other naming
  92. systems to be grandfathered into the URN world, provides independence
  93. between the name assignment system and the resolution protocol system,
  94. and allows multiple services (Name to Location, Name to Description,
  95. Name to Resource, ...) to be offered.  In conjunction with the SRV RR
  96. proposal [3], the NAPTR record allows those services to be replicated
  97. for the purposes of fault tolerance and load balancing.
  98.  
  99.  
  100. Introduction:
  101. =============
  102.  
  103. Uniform Resource Locators have been a significant advance in locating
  104. resources on the Internet. However, their  brittle nature over time
  105. has been recognized for several years. The Uniform Resource Identifier
  106. working group proposed the development of Uniform Resource Names to serve
  107. as persistent, location-independent identifiers for Internet resources
  108. in order to overcome most of the problems with URLs. RFC-1737 [1] sets
  109. forth requirements on URNs.
  110.  
  111. During the lifetime of the URI-WG, a number of URN proposals were
  112. generated. The developers of several of those proposals met in a series
  113. of meetings, resulting in a compromise known as the Knoxville framework.
  114. The major principle behind the Knoxville framework is that the resolution
  115. system must be seperate from the way names are assigned. This is in
  116. marked contrast to most URLs, which identify the host to contact and
  117. the protocol to use. Readers are referred to [2] for background on the
  118. Knoxville framework and for additional information on the context and
  119. purpose of this proposal.
  120.  
  121. Seperating the way names are resolved from the way they are constructed
  122. provides several benefits. It allows multiple naming approaches and
  123. resolution approaches to compete, as it allows different protocols and
  124. resolvers to be used. There is just one problem with such a separation -
  125. how do we resolve a name when it can't give us directions to its
  126. resolver?
  127.  
  128. For the short term, DNS is the obvious candidate for the resolution
  129. framework, since it is widely deployed and understood. However, it is
  130. not appropriate to use DNS to maintain information on a per-resource
  131. basis. First of all, DNS was never intended to handle that many
  132. records. Second, the limited record size is inappropriate for catalog
  133. information. Third, domain names are not appropriate as URNs.
  134.  
  135. Therefore our approach is to use DNS to locate "resolvers" that can
  136. provide information on individual resources, potentially including the
  137. resource itself. To accomplish this, we "rewrite" the URI into a domain
  138. name following the rules provided in NAPTR records. Rewrite rules
  139. provide considerable power, which is important when trying to meet the
  140. goals listed above. However, collections of rules can become difficult
  141. to understand. To lessen this problem, the NAPTR rules are *always*
  142. applied to the original URI, *never* to the output of previous rules.
  143.  
  144. Locating a resolver through the rewrite procedure may take multiple
  145. steps, but the beginning is always the same. Every URI has a
  146. colon-delimited prefix.  NAPTR resolution begins by taking this prefix,
  147. appending the well-known suffix ".urn.net", and querying the DNS for NAPTR
  148. records at that domain name.  Based on the results of this query, zero
  149. or more additional DNS queries may be needed to locate resolvers for the
  150. URI. The details of the conversation between the client and the resolver
  151. thus located are outside the bounds of this draft.
  152. Three brief examples of this procedure are given in the next section.
  153.  
  154. The NAPTR RR provides the level of indirection needed to keep the naming
  155. system independent of the resolution system, its protocols, and services.
  156. Coupled with the new SRV resource record proposal[3] there is also the
  157. potential for replicating the resolver on multiple hosts, overcoming some
  158. of the most significant problems of URLs. This is an important and subtle
  159. point. Not only do the NAPTR and SRV records allow us to replicate
  160. the resource, we can replicate the resolvers that know about the replicated
  161. resource. Preventing a single point of failure at the resolver level
  162. is a significant benefit. Seperating the resolution procedure from the
  163. way names are constructed has additional benefits. Different resolution
  164. procedures can be used over time, and resolution procedures that are
  165. determined to be useful can be extended to deal with additional namespaces.
  166.  
  167.  
  168. Terminology
  169. ===========
  170.  
  171. "Must" or "Shall" - Software that does not behave in the manner that this
  172.            document says it must is not conformant to this document.
  173. "Should" - Software that does not follow the behavior that this document
  174.            says it should may still be conformant, but is probably broken
  175.            in some fundamental way.
  176. "May" -    Implementations may or may not provide the described behavior,
  177.            while still remaining conformant to this document.
  178.  
  179.  
  180. Brief overview and examples of the NAPTR RR:
  181. ============================================
  182.  
  183. A detailed description of the NAPTR RR will be given later, but to give
  184. a flavor for the proposal we first give a simple description of the
  185. record and three examples of its use.
  186.  
  187. The key fields in the NAPTR RR are order, preference, service, flags,
  188. regexp, and replacement:
  189. * The order field specifies the order in which records MUST be processed
  190.   when multiple NAPTR records are returned in response to a single query.
  191.   A naming authority may have delegated a portion of its namespace to
  192.   another agency. Evaluating the NAPTR records in the correct order is
  193.   necessary for delegation to work properly.
  194. * The preference field specifies the order in which records SHOULD
  195.   be processed when multiple NAPTR records have the same value of "order".
  196.   This field lets a service provider specify the order in which resolvers
  197.   are contacted, so that more capable machines are contacted in preference
  198.   to less capable ones.
  199. * The service field specifies the resolution protocol and resolution
  200.   service(s) that will be available if the rewrite specified by the
  201.   regexp or replacement fields is applied. Resolution protocols are
  202.   the protocols used to talk with a resolver. They will be specified in
  203.   other documents. Resolution services are operations such as
  204.   N2R (URN to Resource), N2L (URN to URL), N2C (URN to URC), etc.
  205.   These are discussed in the URN Framework document[2], and their behavior
  206.   in a particular resolution protocol will be given in the specification for
  207.   that protocol.
  208. * The flags field contains modifiers that affect what happens in the
  209.   next DNS lookup, typically for optimizing the process.
  210. * The regexp field is one of two fields used for the rewrite rules, and is
  211.   the core concept of the NAPTR record. The regexp field is a String
  212.   containing a sed-like substitution expression. (The actual grammar for
  213.   the substitution expressions is given later in this draft). The
  214.   substitution expression is applied to the original URN to determine the
  215.   next domain name to be queried. The regexp field should be used when the
  216.   domain name to be generated is conditional on information in the URI. If
  217.   the next domain name is always known, which is anticipated to be a common
  218.   occurrence, the replacement field should be used instead.
  219. * The replacement field is the other field that may be used for the rewrite
  220.   rule. It is an optimization of the rewrite process for the case where the
  221.   next domain name is fixed instead of being conditional on the content of
  222.   the URI. The replacement field is a domain name (subject to compression if
  223.   a DNS sender knows that a given recipient is able to decompress names in
  224.   this RR type's RDATA field). If the rewrite is more complex than a simple
  225.   substitution of a domain name, the replacement field should be set to . and
  226.   the regexp field used. 
  227.  
  228. Note that the client applies all the substitutions and performs all
  229. lookups - this is not handled in DNS servers. Note also that there is no
  230. reason to provide values in both the replacement and regexp field. Only
  231. one should be specified. If a value is specified in both, the replacement
  232. name MUST be used and the regexp string MUST be ignored. It is the belief
  233. of the developers of this document that regexps should rarely be used. The
  234. replacement field seems adequate for the vast majority of situations. Regexps
  235. are only necessary when portions of a namespace are to be delegated to
  236. different resolvers.
  237.  
  238.  
  239.  
  240. Example 1
  241. ---------
  242.  
  243. Consider a URN that uses the hypothetical DUNS namespace. DUNS numbers are
  244. identifiers for approximately 30 million registered businesses around
  245. the world, assigned and maintained by Dunn and Bradstreet. The URN
  246. might look like:
  247.  
  248.                  urn:duns:002372413:annual-report-1997
  249.  
  250. The first step in the resolution process is to find out about the DUNS
  251. namespace. The namespace identifier, duns, is extracted from the URN,
  252. prepended to urn.net, and the NAPTRs for duns.urn.net looked up. It might
  253. return records of the form:
  254.  
  255. duns.urn.net
  256. ;;      order pref flags service          regexp        replacement
  257.  IN NAPTR 100  10  "s"  "dunslink+N2L+N2C"  ""   _dunslink._udp.isi.dandb.com
  258.  IN NAPTR 100  20  "s"  "rcds+N2C"          ""   _rcds._udp.isi.dandb.com
  259.  IN NAPTR 100  30  "s"  "http+N2L+N2C+N2R"  ""   _http._tcp.isi.dandb.com
  260.  
  261. The order field contains equal values, indicating that no name delegation
  262. order has to be followed. The preference field indicates that the provider
  263. would like clients to use the special dunslink protocol, followed by
  264. the RCDS protocol, and that HTTP is offered as a last resort. All the
  265. records specify the "s" flag, which will be explained momentarily.
  266. The service fields say that if we speak dunslink, we will be able to
  267. issue either the N2L or N2C requests to obtain a URL or a URC (description)
  268. of the resource. The Resource Cataloging and Distribution Service (RCDS)[7]
  269. could be used to get a URC for the resource, while HTTP could be used to get
  270. a URL, URC, or the resource itself.  All the records supply the next
  271. domain name to query, none of them need to be rewritten with the aid of
  272. regular expressions.
  273.  
  274. The general case might require multiple NAPTR rewrites to locate a
  275. resolver, but eventually we will come to the "terminal NAPTR". Once we
  276. have the terminal NAPTR, our next probe into the DNS will be for a SRV 
  277. or A record instead of another NAPTR. Rather than probing for a non-existent
  278. NAPTR record to terminate the loop, the flags field is used to indicate
  279. a terminal lookup. If it has a value of "s", the next lookup should
  280. be for SRV RRs, "a" denotes that A records should sought. A "p" flag is
  281. also provided to indicate that the next action is Protocol-specific, but
  282. that looking up another NAPTR will not be part of it.
  283.  
  284. Since our example RR specified the "s" flag, it was terminal. Our
  285. next action is to lookup SRV RRs for _rcds._udp.isi.dandb.com, which
  286. will tell us hosts that can provide the necessary resolution service. 
  287. That lookup might return:
  288.  
  289. ;;                              Pref Weight Port Target
  290.  _rcds._udp.isi.dandb.com IN SRV 0    0    1000 defduns.isi.dandb.com
  291.                           IN SRV 0    0    1000 dbmirror.com.au
  292.                           IN SRV 0    0    1000 ukmirror.com.uk
  293.  
  294. telling us three hosts that could actually do the resolution, and
  295. giving us the port we should use to talk to their RCDS server.
  296. (The reader is referred to the SRV proposal [3] for the interpretation
  297. of the fields above).
  298.  
  299. There is opportunity for significant optimization here. We can return
  300. the SRV records as additional information for terminal NAPTRs
  301. (and the A records as additional information for those SRVs). While this
  302. recursive provision of additional information is not explicitly blessed
  303. in the DNS specifications, it is not forbidden, and BIND does take
  304. advantage of it [4].  This is a significant optimization. In
  305. conjunction with a long TTL for *.urn.net records, the average number
  306. of probes to DNS for resolving DUNS URNs would approach one.
  307. Therefore, DNS server implementors SHOULD provide additional information
  308. with NAPTR responses. The additional information will be either SRV
  309. or A records. If SRV records are available, their A records may be
  310. provided as recursive additional information.
  311.  
  312. Note that the example NAPTR records above are intended to represent the
  313. reply the client will see. They are not quite identical to what the
  314. domain administrator would put into the zone files. For one thing, the
  315. administrator should supply the trailing '.' character on replacement
  316. domain names. An additional difference will be illustrated later.
  317.  
  318.  
  319. Example 2 
  320. ---------
  321.  
  322. Consider a URI namespace based on MIME Content-Ids. The URN might look
  323. like this:
  324.   
  325.         urn:cid:199606121851.1@mordred.gatech.edu
  326.   
  327. The first step in the resolution process is to find out about the CID
  328. namespace. The namespace identifier, cid, is extracted from the URN,
  329. prepended to urn.net, and the NAPTR for cid.urn.net looked up. It might
  330. return records of the form:
  331.  
  332.  cid.urn.net
  333.   ;;       order pref flags service       regexp         replacement
  334.    IN NAPTR 100   10   ""     ""    "/.+@([^@]+)/\1/i"         .
  335.  
  336. We have only one NAPTR response, so ordering the responses is not
  337. a problem.  The replacement field is empty, so we check the regexp
  338. field and use the pattern provided there. We apply that regexp to the
  339. entire URN to see if it matches, which it does.  The \1 part of the
  340. substitution expression returns the string "mordred.gatech.edu". Since
  341. the flags field does not contain "s" or "a", the lookup is not terminal
  342. and our next probe to DNS is for more NAPTR records: lookup(query=NAPTR,
  343. "mordred.gatech.edu").
  344.  
  345. While mordred could have its very own NAPTR, maintaining those records
  346. on all the machines at a site as large as Georgia Tech would be an
  347. intolerable burden. Instead, a wildcard may be used so that the domain
  348. administrator at Georgia Tech has only a single NAPTR record to
  349. maintain. That record might look like:
  350.  
  351. *.gatech.edu IN NAPTR
  352. ;;       order pref flags service           regexp  replacement
  353.   IN NAPTR 100  50  "s"  "z3950+N2L+N2C"    ""   _z3950._tcp.gatech.edu.
  354.   IN NAPTR 100  50  "s"  "rcds+N2C"          ""   _rcds._udp.gatech.edu.
  355.   IN NAPTR 100  50  "s"  "http+N2L+N2C+N2R"  ""   _http._tcp.gatech.edu.
  356.  
  357. (Unlike all the other example records in this draft, the one above
  358. is the contents of a zone file, not the response received by the
  359. client. That is so that the wildcard can be seen.)
  360.  
  361. Continuing with our example, we note that the values of the order and
  362. preference fields are equal in all records, so the client is free to
  363. pick any record. The flags field tells us that these are the last NAPTR
  364. patterns we should see, and after the rewrite (a simple replacement in
  365. this case) we should look up SRV records to get information on the
  366. hosts that can provide the necessary service.
  367.  
  368. Assuming we prefer the Z39.50 protocol, our lookup might return:
  369.  
  370. ;;                            Pref Weight Port Target
  371. _z3950._tcp.gatech.edu IN SRV 0    0      1000 z3950.gatech.edu
  372.                        IN SRV 0    0      1000 z3950.cc.gatech.edu
  373.                        IN SRV 0    0      1000 z3950.uga.edu
  374.  
  375. telling us three hosts that could actually do the resolution, and
  376. giving us the port we should use to talk to their Z39.50 server.
  377.  
  378. Recall that the regular expression used \1 to extract a domain name
  379. from the CID. There is a significant caveat about the use of
  380. backslashes in DNS zone files. DNS treats backslashes as the escape
  381. character so that '.' can be escaped when necessary. This means that
  382. when a regular expression is entered into the zone file, the
  383. backslashes must be escaped by another backslash.  For the case of the
  384. cid.urn.net record above, the regular expression entered into the zone
  385. file should be "/.+@([^@]+)/\\1/i".  When the client code actually
  386. receives the record, the pattern will have been converted to
  387. "/.+@([^@]+)/\1/i".
  388.  
  389.  
  390. Example 3
  391. ---------
  392.  
  393. Even if URN systems were in place now, there would still be a
  394. tremendous number of URLs.  It should be possible to develop a URN
  395. resolution system that can also provide location independence for those
  396. URLs.  This is related to the requirement in [1] to be able to
  397. grandfather in names from other naming systems, such as ISO Formal
  398. Public Identifiers, Library of Congress Call Numbers, ISBNs, ISSNs,
  399. etc.
  400.  
  401. The NAPTR RR could also be used for URLs that have already been assigned.
  402. Assume we have the URL for a very popular piece of software that the
  403. publisher wishes to mirror at multiple sites around the world:
  404.  
  405.      http://www.foo.com/software/latest-beta.exe
  406.  
  407. We extract the prefix, "http", and lookup NAPTR records for
  408. http.urn.net. This might return a record of the form
  409.  
  410. http.urn.net IN NAPTR
  411. ;;  order   pref flags service      regexp             replacement
  412.      100     90   ""      ""   "/.*\/\/([^\/:]+)/\1/i"       .
  413.  
  414. This expression returns everything after the first double slash and
  415. before the next slash or colon. Backslashes are needed to escape the
  416. forward slash since the forward slash character is what separates the
  417. components of the substitution expression. (Recall from the previous
  418. example that in the zone file, this pattern actually needs to be
  419. entered as "/.*\\/\\/([^\\/:]+)/\\1/i").  Applying this pattern to the
  420. URL extracts "www.foo.com". Looking up NAPTR records for that might
  421. return:
  422.  
  423. www.foo.com
  424. ;;       order pref flags   service  regexp     replacement
  425.  IN NAPTR 100  100  "s"   "http+L2R"   ""    _http._tcp.foo.com
  426.  IN NAPTR 100  100  "s"   "ftp+L2R"    ""    _ftp._tcp.foo.com
  427.  
  428. Looking up SRV records for _http._tcp.foo.com would return information
  429. on the hosts that foo.com has designated to be its mirror sites. The
  430. client can then pick one for the user. 
  431.  
  432.  
  433. NAPTR RR Format
  434. ===============
  435.  
  436. The format of the NAPTR RR is given below. The DNS type code for
  437. NAPTR is 104 [this is being changed, we believe it will be assigned 35].
  438.  
  439.     Domain TTL Class Order Preference Flags Service Regexp Replacement 
  440.  
  441. where:
  442.  
  443. Domain
  444.        The domain name this resource record refers to.
  445. TTL
  446.        Standard DNS Time To Live field
  447. Class
  448.        Standard DNS meaning
  449. Order
  450.        A 16-bit integer specifying the order in which the NAPTR records
  451.        MUST be processed to ensure correct delegation of portions
  452.        of the namespace over time. Low numbers are processed before
  453.        high numbers, and once a NAPTR is found that "matches" a URN,
  454.        the client MUST NOT consider any NAPTRs with a higher value
  455.        for order.
  456.  
  457. Preference
  458.        A 16-bit integer which specifies the order in which NAPTR records
  459.        with equal "order" values SHOULD be processed, low numbers
  460.        being processed before high numbers.  This is similar to the
  461.        preference field in an MX record, and is used so domain
  462.        administrators can direct clients towards more capable hosts
  463.        or lighter weight protocols. 
  464.  
  465. Flags
  466.        A String giving flags to control aspects of the rewriting. Flags
  467.        are single characters from the set [A-Z0-9]. The case of the
  468.        alphabetic characters is not significant.
  469.  
  470.        At this time only three flags, "S", "A", and "P", are defined. "S"
  471.        means that the next lookup should be for SRV records instead of NAPTR
  472.        records. "A" means that the next lookup should be for A records. The
  473.        "P" flag says that the remainder of the resolution shall be carried
  474.        out in a Protocol-specific fashion, and we should not do any more
  475.        DNS queries.
  476.        
  477.        The remaining alphabetic flags are reserved. The numeric flags may be
  478.        used for local experimentation. The S, A, and P flags are all mutually
  479.        exclusive, and resolution libraries MAY signal an error if more
  480.        than one is given. (Experimental code and code for assiting in the
  481.        creation of NAPTRs would be more likely to signal such an error than
  482.        a client such as a browser). We anticipate that multiple flags will
  483.        be allowed in the future, so implementors MUST NOT assume that the
  484.        flags field can only contain 0 or 1 characters. 
  485.  
  486.  
  487. Service 
  488.        Specifies the resolution service(s) available down this rewrite
  489.        path. It may also specify the particular protocol that is used to
  490.        talk with a resolver. A protocol MUST be specified if the flags field
  491.        states that the NAPTR is terminal. If a protocol is specified, but
  492.        the flags field does not state that the NAPTR is terminal, the next
  493.        lookup MUST be for a NAPTR. The client MAY choose not to perform
  494.        the next lookup if the protocol is unknown, but that behavior MUST NOT
  495.        be relied upon.
  496.     
  497.        The service field may take any of the values below (using the
  498.        Augmented BNF of RFC 822[5]):
  499.  
  500.            service_field = [ [protocol] *("+" rs)]
  501.            protocol      = "rcds" / "http" / "hdl" / "rwhois"
  502.            rs            = "N2L" / "N2Ls" / "N2R" / "N2Rs" / "N2C"
  503.                          / "N2Ns" / "L2R" / "L2Ns" / "L2Ls" / "L2C"
  504.  
  505.        i.e. an optional protocol specification followed by 0 or more
  506.        resolution services. Each resolution service is indicated by
  507.        an initial '+' character.
  508.  
  509.        Note that the empty string is also a valid service field. This
  510.        will typically be seen at the top levels of a namespace, when it
  511.        is impossible to know what services and protocols will be offered
  512.        by a particular publisher within that name space.
  513.  
  514.        At this time the known protocols are rcds[7], hdl[8] (binary,
  515.        UDP-based protocols),  http[11] (a textual, TCP-based protocol), and
  516.        rwhois[10] (textual, UDP or TCP based). More will be allowed later.
  517.        The names of the protocols must be formed from the characters [a-Z0-9].
  518.        Case of the characters is not significant.
  519.  
  520.        The service requests currently allowed are:
  521.              N2L  - Given a URN, return a URL
  522.              N2Ls - Given a URN, return a set of URLs
  523.              N2R  - Given a URN, return an instance of the resource.
  524.              N2Rs - Given a URN, return multiple instances of the resouce,
  525.                     typically encoded using multipart/alternative.
  526.              N2C  - Given a URN, return a collection of meta-information on
  527.                     the named resource. The format of this response is the
  528.                     subject of another document.
  529.              N2Ns - Given a URN, return all URNs that are also identifers
  530.                     for the resource.
  531.              L2R  - Given a URL, return the resource.
  532.              L2Ns - Given a URL, return all the URNs that are identifiers for
  533.                     the resource.
  534.              L2Ls - Given a URL, return all the URLs for instances of
  535.                     of the same resource.
  536.              L2C  - Given a URL, return a description of the resource.
  537.  
  538.        The actual format of the service request and response will be
  539.        determined by the resolution protocol, and is the subject for other
  540.        documents. Protocols need not offer all services. The labels
  541.        for service requests shall be formed from the set of
  542.        characters [A-Z0-9]. The case of the alphabetic characters is
  543.        not significant.
  544.  
  545. Regexp
  546.        A STRING containing a substitution expression that is applied to the
  547.        original URI in order to construct the next name to lookup. The grammar
  548.        of the substitution expression is given in the next section.
  549.  
  550. Replacement
  551.        The next NAME to query for NAPTR, SRV, or A records depending on
  552.        the value of the flags field. As mentioned above, this may be
  553.        compressed.
  554.  
  555.  
  556.  
  557. Substitution Expression Grammar:
  558. ================================
  559.  
  560. The content of the regexp field is a substitution expression. True sed(1)
  561. substitution expressions are not appropriate for use in this application for a
  562. variety of reasons, therefore the contents of the regexp field MUST follow the
  563. grammar below:
  564.  
  565.   subst_expr   = "/"   ere  "/"  repl  "/"  *flags
  566.   ere          = POSIX Extended Regular Expression (see [9], section 2.8.4)
  567.   repl         = dns_str /  backref / repl dns_str  / repl backref
  568.   dns_str      = ...... which RFC can I cite for this? 1035 seems obsolete .....
  569.   backref      = "\" 1POS_DIGIT
  570.   flags        = "i" 
  571.   DNS_CHAR     = "_" / "0" / "1" / ... / "9" / "a" / ... / "z"
  572.   POS_DIGIT    = "1" / "2" / ... / "9"  ; 0 is not an allowed backref value
  573.  
  574. The result of applying the substitution expression to the original URI shall
  575. be a legal domain name. Since it is possible for the regexp field to be
  576. improperly specified, such that a non-conforming domain name can be
  577. constructed, client software SHOULD verify that the result is a legal
  578. domain name before making queries on it. 
  579.  
  580. Backref expressions "\N" in the repl portion of the substitution expression
  581. are replaced by the (possibly empty) string of characters enclosed by '('
  582. and ')' in the ERE portion of the substitution expression. N is a single
  583. digit from 1 through 9, inclusive. It specifies the N'th backref expression,
  584. the one that begins with the N'th '(' and continues to the matching ')'.
  585. For example, the ERE
  586.                    (A(B(C)DE)(F)G)
  587. has backref expressions:
  588.                     \1  = ABCDEFG
  589.                     \2  = BCDE
  590.                     \3  = C
  591.                     \4  = F
  592.                 \5..\9  = error - no matching subexpression
  593.                  
  594. The "i" flag indicates that the ERE matching SHALL be performed in a
  595. case-insensitive fashion. Furthermore, any backref replacements MAY be
  596. normalized to lower case when the "i" flag is given.
  597.  
  598. Advice to domain administrators:
  599. ================================
  600.  
  601. Beware of regular expressions. Not only are they a pain to get
  602. correct on their own, but there is the previously mentioned interaction
  603. with DNS. Any backslashes in a regexp must be entered twice in a zone
  604. file in order to appear once in a query response. More seriously, the
  605. need for double backslashes has probably not been tested by all
  606. implementors of DNS servers. We anticipate that urn.net will be the
  607. heaviest user of regexps. Only when delegating portions of namespaces
  608. should the typical domain administrator need to use regexps.
  609.  
  610. On a related note, beware of interactions with the shell when manipulating
  611. regexps from the command line. Since '\' is a common escape character in
  612. shells, there is a good chance that when you think you are saying "\\" you
  613. are actually saying "\".  Similar caveats apply to characters such as
  614. '*', '(', etc.
  615.  
  616. The URN-WG is discussing the use of international characters in URNs.
  617. The regexp package used may need to be changed from POSIX to one with
  618. the ability to handle UNICODE characters.
  619.  
  620. The "a" flag allows the next lookup to be for A records rather than
  621. SRV records. Since there is no place for a port specification in the
  622. NAPTR record, when the "A" flag is used the specified protocol must
  623. be running on its default port. 
  624.  
  625.  
  626. Usage
  627. =====
  628.  
  629. Pseudocode for a client routine using NAPTRs is given below:
  630.  
  631.     //
  632.     // findResolver(URN)
  633.     // Given a URN, find a host that can resolve it.
  634.     // 
  635.     findResolver(string URN) {
  636.       sprintf(key, "%s.urn.net", extractNS(URN));  // prepend prefix to urn.net
  637.       do {
  638.         rewrite_flag = false;
  639.         terminal = false;
  640.         if (key has been seen) {
  641.           quit with a loop detected error
  642.         }
  643.         add key to list of "seens"
  644.         records = lookup(type=NAPTR, key); // get all NAPTR RRs for 'key'
  645.  
  646.         sort NAPTR records by "order" field and "preference" field
  647.             (with "order" being more significant than "preference").
  648.         n_naptrs = number of NAPTR records in response.
  649.         curr_order = records[0].order;
  650.         max_order = records[n_naptrs-1].order;
  651.         
  652.         // Process current batch of NAPTRs according to "order" field.
  653.         for (j=0; j < n_naptrs && records[j].order <= max_order; j++) {
  654.           newkey = rewrite(URN, naptr[j].replacement, naptr[j].regexp);
  655.           if (!newkey) // Skip to next record if the rewrite didn't match
  656.              continue;  
  657.           // We did do a rewrite, shrink max_order to current value
  658.           // so that delegation works properly
  659.           max_order = naptr[j].order;
  660.           // Will we know what to do with the protocol and services
  661.           // specified in the NAPTR? If not, try next record.
  662.           if(!isKnownProto(naptr[j].services)) {
  663.             continue;
  664.           }
  665.           if(!isKnownService(naptr[j].services)) {
  666.             continue;
  667.           }
  668.  
  669.           // At this point we have a sucessful rewrite and we will know
  670.           // how to speak the protocol and request a known resolution
  671.           // service. Before we do the next lookup, check some
  672.           // optimization possibilities.
  673.           
  674.           if (strcasecmp(flags, "S")
  675.            || strcasecmp(flags, "P"))
  676.            || strcasecmp(flags, "A")) {
  677.              terminal = true;
  678.              services = naptr[j].services;
  679.              addnl = any SRV and/or A records returned as additional info
  680.                      for naptr[j].
  681.           }
  682.           key = newkey;
  683.           rewriteflag = true;
  684.           break;
  685.         }
  686.       } while (rewriteflag && !terminal);
  687.  
  688.       // Did we not find our way to a resolver?
  689.       if (!rewrite_flag) {
  690.          report an error
  691.          return NULL;
  692.       }
  693.  
  694.  
  695.       // Leave rest to another protocol?
  696.       if (strcasecmp(flags, "P")) {
  697.          return key as host to talk to;
  698.       }
  699.  
  700.       // If not, keep plugging
  701.       if (!addnl) { // No SRVs came in as additional info, look them up
  702.         srvs = lookup(type=SRV, key);
  703.       }  
  704.  
  705.       sort SRV records by preference, weight, ...
  706.       foreach (SRV record) { // in order of preference
  707.         try contacting srv[j].target using the protocol and one of the
  708.             resolution service requests from the "services" field of the
  709.             last NAPTR record.
  710.         if (successful)
  711.           return (target, protocol, service);
  712.           // Actually we would probably return a result, but this
  713.           // code was supposed to just tell us a good host to talk to.
  714.       }
  715.       die with an "unable to find a host" error;
  716.     }
  717.  
  718.  
  719. Notes:
  720. ======
  721.   -  The "urn:" prefix is a matter of religious controversy. Client
  722.      code should handle the cases when it is and is not present.
  723.      Similarly, if regular expressions are used in NAPTR records, they
  724.      should be immune to the presence or absence of an initial "urn:".
  725.   -  A client MUST process multiple NAPTR records in the order specified by
  726.      the "order" field, it MUST NOT simply use the first record that provides
  727.      a known protocol and service combination.
  728.   -  If a record at a particular order matches the URI, but the client
  729.      doesn't know the specified protocol and service, the client SHOULD
  730.      continue to examine records that have the same order. The client
  731.      MUST NOT consider records with a higher value of order. This is
  732.      necessary to make delegation of portions of the namespace work.
  733.      The order field is what lets site administrators say "all requests for
  734.      URIs matching pattern x go to server 1, all others go to server 2".
  735.      (A match is defined as:
  736.         1) The NAPTR provides a replacement domain name
  737.         2) The regular expression matches the URN
  738.      )
  739.   -  When multiple RRs have the same "order", the client should use
  740.      the value of the preference field to select the next NAPTR to
  741.      consider. However, because of preferred protocols or services,
  742.      estimates of network distance and bandwidth, etc. clients
  743.      may use different criteria to sort the records.
  744.   -  If the lookup after a rewrite fails, clients are strongly encouraged
  745.      to report a failure, rather than backing up to pursue other rewrite
  746.      paths.
  747.   -  When a namespace is to be delegated among a set of resolvers, regexps
  748.      must be used. Each regexp appears in a separate NAPTR RR. Administrators
  749.      should do as little delegation as possible, because of limitations on
  750.      the size of DNS responses.
  751.   -  Note that SRV RRs impose additional requirements on clients.
  752.  
  753.  
  754. Acknowledgments:
  755. =================
  756.  
  757. The authors would like to thank Keith Moore for all his consultations
  758. during the development of this draft. We would also like to thank Paul
  759. Vixie for his assistance in debugging our implementation, and his answers
  760. on our questions.
  761.  
  762.  
  763. References:
  764. ===========
  765.  
  766. [1] RFC-1737 "Functional Requirements for Uniform Resource Names", Karen
  767.     Sollins and Larry Masinter, Dec. 1994.
  768.  
  769. [2] draft-daigle-urn-framework-00.txt "A Uniform Resource Naming
  770.     Framework", Leslie Daigle and Patrik Faltstrom, June, 1996.
  771.  
  772. [3] draft-gulbrandsen-dns-rr-srvcs-03.txt  " A DNS RR for specifying the
  773.     location of services (DNS SRV)",  Arnt Gulbrandsen and Paul Vixie,
  774.     March 1996.
  775.  
  776. [4] Paul Vixie, personal communication.
  777.  
  778. [5] RFC-822 "Standard for the Format of ARPA Internet Text Messages",
  779.     Dave H. Crocker, August 1982.  
  780.  
  781. [6] Keith Moore, personal communication.
  782.  
  783. [7] Keith Moore, "Resource Cataloging and Distribution Service", ???
  784.     (insert as [4], renumber the others?)
  785.  
  786. [8] Charles Orth, Bill Arms; Handle Resolution Protocol Specification,
  787.     http://www.handle.net/docs/client_spec.html
  788.  
  789. [9] IEEE Standard for Information Technology - Portable Operating System
  790.     Interface (POSIX) - Part 2: Shell and Utilities (Vol. 1); IEEE Std
  791.     1003.2-1992; The Institute of Electrical and Electronics Engineers;
  792.     New York; 1993. ISBN:1-55937-255-9
  793.  
  794. [10] ... rwhois spec ...
  795. [11] ... encoding resolution service requests in HTTP...
  796.  
  797.  
  798. Security Considerations
  799. =======================
  800.   The use of "urn.net" as the registry for URN namespaces is subject to
  801.   denial of service attacks, as well as other DNS spoofing attacks. The
  802.   interactions with DNSSEC are currently being studied. It is expected
  803.   that NAPTR records will be signed with SIG records once the DNSSEC
  804.   work is deployed. 
  805.  
  806.   The rewrite rules make identifiers from other namespaces subject to
  807.   the same attacks as normal domain names. Since they have not been
  808.   easily resolvable before, this may or may not be considered a problem.
  809.  
  810.   Regular expressions should be checked for sanity, not blindly passed
  811.   to something like PERL. 
  812.  
  813. Author Contact Information:
  814. ===========================
  815.  
  816. Ron Daniel
  817. Los Alamos National Laboratory
  818. MS B287
  819. Los Alamos, NM, USA, 87545
  820. voice:  +1 505 665 0597
  821. fax:    +1 505 665 4939
  822. email:  rdaniel@lanl.gov
  823.  
  824.  
  825. Michael Mealling
  826. Network Solutions
  827. 505 Huntmar Park Drive
  828. Herndon, VA  22070
  829. voice: (703) 742-0400
  830. fax: (703) 742-9552
  831. email: michaelm@internic.net
  832. URL: http://www.netsol.com/
  833.  
  834.  
  835.  
  836.  
  837.     This draft expires 05 May, 1997.
  838.  
  839.  
  840.  
  841. Ron Daniel Jr.                       email: rdaniel@lanl.gov
  842. Advanced Computing Lab               voice: +1 505 665 0597
  843. MS B287                                fax: +1 505 665 4939
  844. Los Alamos National Laboratory        http://www.acl.lanl.gov/~rdaniel/
  845. Los Alamos, NM, USA  87545    obscure_term: "hyponym"
  846.